package sphere.view;

import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.Panel;
import java.awt.Label;
import java.awt.TextField;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import sphere.controller.SphereControleur;





public class SphereWindow extends Frame {
	private Panel panel1;
	private Label L;
	private TextField rayon;
	private TextField SurfaceTextField;
	private TextField VolumeTextField;
	
	public SphereWindow(String titre){
		super(titre);
		PrivListener monListener = new PrivListener();
		this.addWindowListener(monListener);
		this.setLayout(new FlowLayout());
		this.panel1 = new Panel();
		this.panel1.setLayout(new GridLayout(4, 2, 10, 10));
		this.L = new Label("Radius = ");
		this.panel1.add(L);
		this.rayon = new TextField();
		this.panel1.add(rayon);
		SphereControleur monSphereControler = new SphereControleur(this);
		rayon.addTextListener(monSphereControler);
		this.L = new Label("Surface = ");
		this.panel1.add(L);
		this.SurfaceTextField = new TextField("");
		this.panel1.add(SurfaceTextField);
		this.L  = new Label("Volume = ");
		this.panel1.add(L);
		this.VolumeTextField = new TextField("");
		this.panel1.add(VolumeTextField);
		this.add(panel1);
		
		this.pack();
		this.setVisible(true);
	}
	
	/**
	 * @return the rayon
	 */
	public TextField getRayon() {
		return rayon;
	}

	/**
	 * @param rayon the rayon to set
	 */
	public void setRayon(TextField rayon) {
		this.rayon = rayon;
	}

	

	

	protected class PrivListener extends WindowAdapter{
		public void windowClosing(WindowEvent e){
			System.exit(0);
		}
	}

	public void setVolumeTextField(String valume) {
		// TODO Auto-generated method stub
		this.VolumeTextField.setText(valume);
		
		
	}

	public void setSurfaceTextField(String surface) {
		// TODO Auto-generated method stub
		this.SurfaceTextField.setText(surface);
		
	}

	
}
